/* ====================================================================
 * Copyright (C) 2012 - Deniz Sezen
 * ====================================================================
 * File: dx_augsystem.h
 * Purpose: Interface to the DX:HR augmentation system.
 * ====================================================================
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef _DX_AUGSYSTEM_H
#define _DX_AUGSYSTEM_H

/************************************************************************/
/* Includes                                                             */
/************************************************************************/
#include <string.h>

/************************************************************************/
/* Signatures.                                                          */
/************************************************************************/

// This is the signature for the AugmentationSystem constructor. We hook this to
// grab the class instance for the AugmentationSystem.
#define ENERGYDATA_SIG     "\xD9\x05\x2A\x2A\x2A\x2A\x53\x55\x33\xDB\x56\x8B\xF1\x57\xD9\x5E\x18\x53\xC7\x06\x2A\x2A\x2A\x2A"
#define ENERGYDATA_SIG_LEN 24

/************************************************************************/
/* Classes we need.                                                     */
/************************************************************************/
class UpgradeDescriptor_Float
{
	public:
		const char* Name;		// +4
		float		Value;		// +8
		float*		pValue;		// +12
		int			Unk;		// +16

	public:
		// Required in order to tell the compiler that
		// there is a vtable.
		virtual void stub() = 0;

	public:
		// Utility functions added for convenience.
		float GetValue( void ) {
			return *pValue;
		}

		float SetValue( float value ) {
			*pValue = value;
		}
};

/************************************************************************/
/* Structs we need.                                                     */
/************************************************************************/
class AugmentationSystem {
	public:
		char				     m_szUnknown[55];
		UpgradeDescriptor_Float* m_Objects[64];

		UpgradeDescriptor_Float* FindObject( const char* szName ) {
			for( int i = 0; i < 64; i++ ) {
				if( strcmp(szName, m_Objects[i]->Name) == 0 ) {
					return m_Objects[i];
				}
			}

			return NULL;
		}
};

/************************************************************************/
/* Global variables we need.                                            */
/************************************************************************/
extern AugmentationSystem* g_pAugmentationSystem;

/************************************************************************/
/* Global functions we need.                                            */
/************************************************************************/
void Init_AugSystem( void );

#endif // _DX_AUGSYSTEM_H